<?php
// $Id$

include_once(APP_LIB_DIR . 'PollModel.class.php');
require_once(APP_LIB_DIR . 'LookupModel.class.php');
include_once(APP_LIB_DIR . 'paging.class.php');
include_once(APP_LIB_DIR . 'JSON.php');

class PollResultAction extends Action
{
    function getRequestMethods ()
    {
        return REQ_GET|REQ_POST;
    }

    function isSecure ()
    {
        return false;
    }

    function getPrivilege (&$controller, &$request, &$user)
    {
        return Array('POLLRESULT');
    }

    function getDefaultView (&$controller, &$request, &$user)
    {
        return VIEW_INPUT;
    }

    function execute (&$controller, &$request, &$user)
    {
        $pm     = new PollModel('PollResultAction');
        $list = false;
        $detail=array();
        $options =array();
        if($poll_id = $request->getParameter('poll_id')){
            //$list = $pm->get_result($poll_id);
            $detail = $pm->detail($poll_id);
            $options = $pm->options($poll_id);

        }
        $request->setAttribute('list', $list);
        $request->setAttribute('detail', $detail);
        $request->setAttribute('options', $options);
        $request->setAttribute('all', $pm->get_all());
        return VIEW_INPUT;
    }

}

?>
